forum

home / developersection / forums / char char = int? why?

char char = int? Why?

Royce Roy 2456 06-Jun-2013
Hi All,

Why is adding two char in C# results to an int type?

For example, when I do this:

var pr = 'R' + 'G' + 'B' + 'Y' + 'P';
the pr variable becomes an int type. I expect it to be a string type with a value of "RGBYP".

Why is C# designed like this? Wasn't the default implementation of adding two chars should be resulting to a string that concatenates the chars, not int?

Thanks in advance. 


c# c# 
Updated on 06-Jun-2013
Royce Roy

Other


Message
Can you answer this question?

Answer

1 Answers

Liked By